﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
using libtcodWrapper;
using Console = libtcodWrapper.Console;

namespace HDHack
{
    class InventoryInterface
    {
        Console displayConsole;        
        public bool IsActive = false;
        Dungeon theDungeon;
        Player p;

        public InventoryInterface(Player ip, Console dCon, Dungeon d)
        {            
            p = ip;
            displayConsole = dCon;
            theDungeon = d;
        }

        public void DisplayInventory()
        {            
            displayConsole.Clear();            
            int lastline = 1;
            int itemASCIIIndex = 97;
            if (p.Inventory.Count > 0)
            {
                lastline = displayConsole.PrintLineRect("You have the following items:", 1, 1, displayConsole.GetConsoleWidth(), displayConsole.GetConsoleHeight(), LineAlignment.Left);
                lastline++;
                displayConsole.PrintLine("", 1, lastline, LineAlignment.Left);
                lastline++;


                foreach (Item i in p.Inventory)
                {
                    displayConsole.PrintLine(i.name, 1, lastline, LineAlignment.Left);
                    itemASCIIIndex++;
                    lastline++;

                }                
                //IsActive = true;

            }
            else
            {
                displayConsole.PrintLine("You have nothing!", 1, lastline, LineAlignment.Left);
                theDungeon.ComplexCommand = false;
                IsActive = false;

            }
        }



    }
}
